﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="contribute.aspx.cs" Inherits="Com.Web.coffinegurunaru.manager.banner.contribute" MasterPageFile="~/manager/page/ManagerMasterPage.Master" %>
<%@ Register TagPrefix="UC" TagName="Menu" Src="~/manager/banner/menu.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phHead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="phContent" runat="server">
<hr />
<br />
<table>
<tr>
	<td valign="top">
		<UC:Menu ID="Menu1" SubPageType=3 runat="server" />
	</td>
	<td style="width:20px;"></td>
	<td valign="top">



<div id="divAdd">
<table cellpadding="0" cellspacing="1" style="background-color:Gray; width:100%;">
<tr>
	<td style="background-color:Silver; text-align:center; width:150px; height:25px;">타이틀이미지</td>
	<td style="background-color:#ffffff; ">&nbsp;&nbsp;<input type="text" id="txtTitleImageURL" readonly="readonly" size="60" /><input type="button" id="btTitleImageURL" value="타이틀 업로드"/></td>
</tr>
<tr>
	<td style="background-color:Silver; text-align:center; width:150px; height:25px;">뷰이미지</td>
	<td style="background-color:#ffffff; ">&nbsp;&nbsp;<input type="text" id="txtImageURL" readonly="readonly" size="60" /><input type="button" id="btImageURL" value="보기 업로드"/></td>
</tr>
<tr>
	<td style="background-color:Silver; text-align:center; width:150px; height:25px;">링크</td>
	<td style="background-color:#ffffff; ">&nbsp;&nbsp;<input type="text" id="txtLinkURL" maxlength="150" size="60" /></td>
</tr>
<tr>
	<td align="center" colspan="2" style="background-color:#ffffff; "><input type="button" value="등록" id="m_btnSave"/></td>
</tr>
</table>
</div>
<br />
<div id="divList">
</div>



	</td>
</tr>
</table>




<script language="javascript" type="text/javascript">
(function($) {
	$.Contribute = {};
	
	$.Contribute = {
		Win : null,
		Init : function() {
			$("#btImageURL").click(function() {
				$.Contribute.FileOpen();
			});
			
			$("#btTitleImageURL").click(function() {
				$.Contribute.FileOpen_Title();
			});
			
			$("#m_btnSave").click(function() {
				$.Contribute.Create();
			});
			
			$.Contribute.GetList();
		},
		
		FileOpen_Title : function()
		{
			$.manager.fileopen(19, "$.Contribute.FileOpen_Title_Callback");
		},
		
		FileOpen_Title_Callback : function( url )
		{
			$("#txtTitleImageURL").val( url );
		},
		
		FileOpen : function()
		{
			$.manager.fileopen(19, "$.Contribute.FileOpen_Callback");
		},
		
		FileOpen_Callback : function( url )
		{
			$("#txtImageURL").val( url );
		},
		
		Create : function() {
			var ImageURL = $("#txtImageURL").val();
			var TitleImageURL = $("#txtTitleImageURL").val();
			var LinkURL = $("#txtLinkURL").val();
			if ( ImageURL == "" )
			{
				alert( "보기 이미지를 선택하세요.");
				return false;
			}
			
			if ( TitleImageURL == "" )
			{
				alert( "제목 이미지를 선택하세요.");
				return false;
			}

			
			$("#divAdd").ajaxNet(
			"/manager/banner/ContributeMethod.aspx?_vb=Create",
			{
				"TitleImageURL" : TitleImageURL
			,	"ImageURL" : ImageURL
			,	"LinkURL" : LinkURL
			}, function(results, context)
			{
				alert('등록되었습니다.');
				$.Contribute.GetList();
			});
		},

		Remove : function( $elem ) {
			var IndexNo = $elem.tagdata().IndexNo;
			if ( confirm( "정말로 삭제하시겠습니까?") ) {
				$("#divAdd").ajaxNet(
				"/manager/banner/ContributeMethod.aspx?_vb=Remove",
				{
					"IndexNo" : IndexNo
				}, function(results, context)
				{
					alert('삭제되었습니다.');
					$.Contribute.GetList();
				});
			}
		},
		
		GetList : function() {
			$("#m_PoupList").ajaxNet(
			"/manager/banner/ContributeMethod.aspx?_vb=GetList",
			{
				"PageNo" : 1,
				"PageSize" : 100
			}, function(results, context)
			{
				$("#divList").html(results);
				$("#divList input.m_btRemove").click(function() {
					$.Contribute.Remove( $(this).closest("tr") );
				});
			});
		}
	}
	
	$(function() {
		$.Contribute.Init();
	});
})(jQuery);
</script>


</asp:Content>